let baseURL = 'http://www.itcbc.com:8080'

$.ajaxPrefilter(function(option) {

    option.url = baseURL + option.url
        // 统一设置请求头
    option.headers = {
            Authorization: localStorage.getItem('token')
        }
        //统一配置complete

    option.complete = function(xhr) {
        // 判断token的真假
        // console.log(xhr); //responseJSON是服务器返回的结果
        let res = xhr.responseJSON
        if (res && res.status === 1 && res.message === "身份认证失败！") { //必须完全一模一样 
            localStorage.removeItem('token')
            location.href = './login.html'
        }
    }
})